package com.login.action;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import com.common.util.BaseAction;
import com.login.service.ILoginServ;

/**
 * 
 * @author chengyonghang
 * @version 1.0
 * @since 2013-7-11 下午04:01:57
 * @category com.action
 * 
 * 
 */
public class LoginAction extends BaseAction{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private String            txtUserName;
    private String            txtUserPassword;
    private String            txtSN; 
    private List<List<Map>>  managingFinancialResult;
     
    private ILoginServ logServ;

  

    public String getTxtUserName() {
		return txtUserName;
	}

	public void setTxtUserName(String txtUserName) {
		this.txtUserName = txtUserName;
	}

	public String getTxtUserPassword() {
		return txtUserPassword;
	}

	public void setTxtUserPassword(String txtUserPassword) {
		this.txtUserPassword = txtUserPassword;
	}
	
	

	public List<List<Map>> getManagingFinancialResult() {
		return managingFinancialResult;
	}

	public void setManagingFinancialResult(List<List<Map>> managingFinancialResult) {
		this.managingFinancialResult = managingFinancialResult;
	}

	/**
	 * 验证用户
	 * @return
	 */
	public String isLegalUser() {
		String code = txtSN;// 页面，用户输入的验证码  
	     HttpSession session = request.getSession();  
	        String randCode = (String)session.getAttribute("randomCode");// 得到系统生成的验证码  
		          
		boolean result =logServ.isLegalUser(txtUserName, txtUserPassword);
		System.out.print("--------"+result);
		boolean resultCode = randCode.equals(code);

		if(result&&resultCode)
		{
        return "isTrueUser";
		}
		else {
			return "isFalseUser";
		}

    }
	
	
    /**
     * 登录初始化页面吧 
     * @return
     */
    public String execute() {
        return "success";
    }

	public ILoginServ getLogServ() {
		return logServ;
	}

	public void setLogServ(ILoginServ logServ) {
		this.logServ = logServ;
	}
	
	
	public  String managingFinancialInit()
	{
		managingFinancialResult =logServ.managingFinancialInit();
		return "managingFinancialInit";
	}

	public String getTxtSN() {
		return txtSN;
	}

	public void setTxtSN(String txtSN) {
		this.txtSN = txtSN;
	}
	
	
    
    


}
